<?php
$db = \fate\db\Db::instance('main');
$this->headAssets = [
    '<link href="'. RES .'/pc/css/index.css" rel="stylesheet" />'
];
$recom_article = $db->prepareSql('select id,title,thumb from t_post where is_recommend=1 order by id desc limit 0,6')->queryAll();
$newposts = $db->prepareSql('select id,title,thumb,post_time from t_post where status=1 order by id desc limit 0,10')->queryAll();
$links = (new \app\models\Links())->getListByCondition('id,title,link', '1=1');
?>

<div class="x-wrapper x-section-header">
    <a class="x-pullright x-section-header-more" target="_blank" href="<?php echo \app\libs\Util::U('category', ['id' => 1]); ?>">更多</a>
    <h3 class="x-section-header-title">最新</h3>
</div>
<ul class="x-wrapper x-generallist-wrapper" id="generallist">
    <!-- list-item
    <li class="x-generallist-item">
        <div class="x-generallist-item-img-wrapper">
            <a class="x-generallist-item-img" style="background-image:url(https://imgoss.douyucdn.cn/bj/yuba/default/2019/08/14/201908141618204450812285498.jpg)" href=""></a>
        </div>
        <h3 class="x-generallist-item-title">
            <a href="">这是一个标题这是一个标题这是一个标题</a>
        </h3>
        <div class="x-generallist-item-user">
            <a href="">张三呀</a>
        </div>
    </li>
    // list-item -->
<?php foreach($newposts as $v){ ?>
<li class="x-generallist-item">
    <div class="x-generallist-item-img-wrapper">
        <a class="x-generallist-item-img" style="background-image:url(<?php echo $v['thumb']; ?>)" href="<?php echo \app\libs\Util::U('posts', ['id' => $v['id']], '.html'); ?>"></a>
    </div>
    <h3 class="x-generallist-item-title">
        <a target="_blank" href="<?php echo \app\libs\Util::U('posts', ['id' => $v['id']], '.html'); ?>" title="<?php echo $v['title']; ?>"><?php echo $v['title']; ?></a>
    </h3>
</li>
<?php } ?>
</ul>

<div class="x-wrapper">
    <h3 class="x-section-header-title i-link-title">友情链接</h3>
    <div>
<?php if($links) { foreach($links as $val){ ?>
<a target="_blank" class="i-link-item" href="<?php echo $val['link']; ?>"><?php echo $val['title']; ?></a>
<?php }} ?>
    </div>
</div>

<script type="text/javascript" src="<?php echo RES; ?>/pc/js/index.js"></script>
